// pages/index/index.js
Page({
  data: {
    // 页面数据
  },

  onLoad: function (options) {
    // 页面加载时的逻辑
    console.log('首页加载完成');
  },

  onShow: function () {
    // 页面显示时的逻辑
  },

  // 跳转到捐献登记页面
  goToDonate: function () {
    wx.switchTab({
      url: '/pages/donate/donate'
    });
  },

  // 跳转到追思悼念页面
  goToMemorial: function () {
    wx.switchTab({
      url: '/pages/memorial/memorial'
    });
  },

  // 跳转到志愿者中心
  goToVolunteer: function () {
    wx.switchTab({
      url: '/pages/volunteer/volunteer'
    });
  },

  // 跳转到生命教育展馆
  goToExhibition: function () {
    wx.navigateTo({
      url: '/pages/exhibition/exhibition'
    });
  },

  // 跳转到捐献站点指引
  goToSiteGuide: function () {
    wx.navigateTo({
      url: '/pages/site-guide/site-guide'
    });
  },

  // 跳转到告别仪式
  goToCeremony: function () {
    wx.navigateTo({
      url: '/pages/ceremony/ceremony'
    });
  },

  // 跳转到登记查询
  goToQuery: function () {
    wx.navigateTo({
      url: '/pages/query/query'
    });
  },

  // 跳转到预约管理
  goToAppointment: function () {
    wx.navigateTo({
      url: '/pages/exhibition/exhibition?type=appointment'
    });
  },

  // 跳转到积分商城
  goToPointsMall: function () {
    wx.navigateTo({
      url: '/pages/volunteer/mall'
    });
  },

  // 跳转到资讯列表
  goToNews: function () {
    wx.navigateTo({
      url: '/pages/news/news'
    });
  },

  // 跳转到资讯详情
  goToNewsDetail: function (e) {
    const id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/news/news-detail?id=${id}`
    });
  },

  // 分享功能
  onShareAppMessage: function () {
    return {
      title: '让生命以另一种方式延续 - 爱道・遗体捐献',
      path: '/pages/index/index',
      imageUrl: '/images/share-cover.png'
    };
  },

  // 分享到朋友圈
  onShareTimeline: function () {
    return {
      title: '让生命以另一种方式延续 - 爱道・遗体捐献',
      imageUrl: '/images/share-cover.png'
    };
  }
});
